package cn.nbt.busManage.model.vo;

import cn.nbt.busManage.model.dto.PointDto;
import cn.nbt.busManage.model.dto.RouteDto;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.Getter;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * {@code @Author} lyq
 * {@code @Date} 6/13/2024 7:04 PM
 */

@Getter
public class RouteVo implements Serializable {
    private final Integer id;
    private final String routeName;
    private final Integer startPointId;
    private final Integer endPointId;
    private final String points;
    private final String times;
    //    起始站-终点站
    private String startToEndPoint;
    //    站点列表
    private List<PointDto> pointList;
    //    站点1-站点2 时间xxx
    @JsonIgnore
    private List<Map<List<PointDto>,String>> pointsTime;
    //    总时间
    private Integer sumTime;

    public RouteVo(RouteDto routeDto){
        this.id = routeDto.getId();
        this.routeName = routeDto.getRouteName();
        this.startPointId = routeDto.getStartPointId();
        this.endPointId = routeDto.getEndPointId();
        this.points = routeDto.getPoints();
        this.times = routeDto.getTimes();
        this.startToEndPoint = routeDto.getStartToEndPoint();
        this.pointList = routeDto.getPointDtos();
        this.pointsTime = routeDto.getPointsTime();
        this.sumTime = routeDto.getSumTime();

    }

    @JsonCreator
    public RouteVo(@JsonProperty("id") Integer id,
                   @JsonProperty("routeName") String routeName,
                   @JsonProperty("startPointId") Integer startPointId,
                   @JsonProperty("endPointId") Integer endPointId,
                   @JsonProperty("points") String points,
                   @JsonProperty("times") String times
                   ){
        this.id = id;
        this.routeName = routeName;
        this.startPointId = startPointId;
        this.endPointId = endPointId;
        this.points = points;
        this.times = times;
    }
}
